<div class="span-20" style="float:right;" id="login-message">
<?php

	$sessiondata=$this->session->all_userdata();
	$username="";
	if(array_key_exists('username',$sessiondata)){
		$username=$this->session->userdata['username'];
		$company_name=$this->session->userdata['OrgName'];
	}
	echo '<ul class="horizontal">';
 if($username != ""){
	 echo '<li>Welcome <b>';
	 echo $company_name."!</b></li>";
 }else{
	echo '&nbsp;';
 }

?>


<?php

 if($username != ""){
	 echo '<li><a id="logout-link">Logout</a></li>';
 }else{
     echo '<li><a id="register-link">Register</a></li><li><a id="login-link">Login</a></li>';
 }

 echo '</ul>';
?>
</div>	
<script type="text/javascript">
  $(document).ready(function(){

		$('a#register-link').click(function(){
			$('#tenant-page').load('index.php/viewloader/tenant_register');
		});	

		$('a#login-link').click(function(){
			$('#tenant-page').load('index.php/viewloader/tenant_login');
		});	

		$('a#logout-link').click(function(){
			$('#tenant-page').load('index.php/viewloader/sess_destroy');
			$('div#login-bar-placeholder').html('');
		});	

  });

</script>
